How to release application plugin using Android Market?
It's quite simple in your case, since you don't need any extra logic, but just more levels, so I will stick to this specific case:
You can (or probably already do) have your game levels saved as resources in your .apk, so a plug in can be a standard .apk, that will not appear in the list of users-apps. To prevent it from appearing, simply don't declare the category-launcher:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Once the snippet above does NOT appear in your plugin's AndroidManifest, it will not be directly accessible to the user.
When your main game activity starts, it should check for the existence of plugins, you can do it, by calling PackageManager.queryIntentActivities
. And querying for a specific intent you declared in the AndroidManifest file of your plugin, for example:
<intent-filter>
<action android:name="com.your.package.name.LEVEL_PACK" />
</intent-filter>
The query code would then be:
PackageManager packageManager = getPackageManager();
Intent levelsIntent = new Intent("com.your.package.name.LEVEL_PACK");
List<ResolveInfo> levelPacks = packageManager.queryIntentActivities(levelsIntent, 0);
There are more ways to do this, but this is quite trivial and straight forward.
The last step is to access the levels from the installed level-packs. You can do this by calling: PackageManager.getResourcesForActivity
and load the relevant resources and use them as you will.
Write an application that can use plugins
You can use PackageManager to look for another application. If you know the package names of all of the 'plugins' then you can just check for each of them this way.
PackageManager pm = getPackageManager();
try {
ApplicationInfo appInfo = pm.getApplicationInfo("com.package.name.your.looking.for", 0);
//if we get to here then the app was found, do whatever you need to do.
} catch (NameNotFoundException e) {
//app was not found
}
How to build pluggable apps for Android?
Well, you can simply send a broadcast that is received by all plugins (make sure they have a signature based permission!)
You might want to have a look at How to release application plugin using Android Market?
Publish custom application on android market
There is no official Android Market support for this, but there are APIs and 3rd party solutions, take a look at the answers to this post.
Publish APP to Android market, where to embed my own key?
You only need the key if you have implemented licensing (http://developer.android.com/guide/publishing/licensing.html)
Android Market Application Updates
Normally the Market Application will let the user that updates are available for one or more of their installed applications via a Status Bar notification, but users aren't forced to install the update.
I think stopping the application working after a time period, forcing to the user to install a new update is not a good thing to do because:
- A user might not want to update your application if it's working. Updating a lot of applications via the Market can be chore due to the interminable prompts so I sometimes don't get round to updating applications as soon as updates are available.
- It forces you to release possibly needless updates when the previous version is about to time out.
- It's not very nice to the users.
Why do you want to force updates on users? If you explain the problem you are trying to solve by doing this someone might be able to give you a better solution.
The only thing you can do to make it more likely that users will upgrading update the description of your application in the Market to include the benefits of upgrading, as users can read the update description before deciding whether to upgrade.
Start Android Market from App
Found answer in the end:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://search?q=pname:MyApp"));
startActivity(intent);
No way of testing on emulator, though.
Related Topics
Android Fragmenttransaction Custom Animation (Unknown Animator Name: Translate)
How to Finish Activity When Starting Other Activity in Android
How to Detect When the User Launches Another App? (Android)
Mediametadataretriever.Getframeattime() Returns Only First Frame
Android Listview: Get Data Index of Visible Item
Triggering Event When Button Is Pressed Down in Android
Nullpointerexception from Google Maps
Changing Locale: Force Activity to Reload Resources
Inflate a View in a Background Thread
How to Get Dependencies from Jcenter with a New Project
Custom 'Keyboard' Built in an Application on Android
How to Get Information About Android Battery Usage by Application
How to Launch the 'Add Contact' Activity in Android
Difference Between Addvalueeventlistener() and Addlistenerforsinglevalueevent() of Firebase
Unexpected Namespace Prefix "Xmlns" Found for Tag Linearlayout