I am using Android HockeyAppSDK to deploy updates to an application. I am trying to use the docs to customise the default UpdateManager class to allow updates to be installed automatically, without prompting the user to accept the update.
I am quite unsure of how to handle this. The obvious way (in my mind anyway) is to do the following:
private void checkForUpdates () {
UpdateManager.register (this, Constants.HOCKEY_API_KEY, new UpdateManagerListener() {
public void onUpdateAvailable() {
//I assume stuff will need to be handled here
}
});
}
Has anyone done this before, or can find a way to do it?
Many thanks
After emailing the support team for Hockey, they believe that within their current compiled API it is not possible to perform an update without prompting users to accept.
The whole source would require modification and compilation before working as expected it seems.
You can use UpdateTask from library
Related
I am trying to get call-recording to work with native UI integration using flutter, CallKit (iOS) and ConnectionService (Android).
Since there is no guide for integrating flutter with CallKit and ConnectionService or any other service to enable system-like call recording without root access or jailbreak, this question has come to existence.
There are a lot of apps available for jailbroken devices and android does natively support call recording, but there is no concrete guide for implementing the same using flutter.
Using flutter 1.7 with AndroidX support for back-compatibility of marshmallow+ ConnectionService.
The expected result is to automatically record calls or prompt user to do so whenever there is an incoming call.
Currently unable to do it at all, maybe I am missing something essential in the documentation or I don't have the sufficient know-how for the successful execution of creating a system-supported call-recording app using flutter.
Since there is no guide for integrating flutter with CallKit and ConnectionService ...
In short, mentioned via comments, you’ll have to refer to https://flutter.dev/docs/development/platform-integration/platform-channels to do it yourself by implementing platform-specific code such as CallKit/ConnectionService.
First, because there’s currently likely no Flutter library that has already conveniently packaged this up for you, at least not at https://pub.dev/flutter, so this is why you need to do it yourself.
Now, assuming all the restrictions, permissions, rooting, jailbreaking, etc. poses no issue to you, then you would need to implement these APIs natively in iOS/Android first, for example, Android:
#Override
public void onMethodCall(MethodCall call, Result result) {
if (call.method.equals("recordCall")) {
result.success(recordCall());
}
}
Which will then allow you to call them from Flutter:
_recordCall() {
var recording = await platform.invokeMethod('recordCall');
}
So don’t think of how to do this in Flutter, the above was the easy part.
Your perspective should be: how to do this on iOS/Android, because the magic is in recordCall()
My App created by Meteor is now doing upgrading by Meteor's HCP(Hot Code Push), which means the user will get a new version as soon as he restarts the App, without any information or confirm dialog.
HCP is great, but there are two reasons some users don't want the App be upgraded quietly:
New version may have degrades or other risks.
Old version is enough for theirs uses.
So I want to know if there is a way, I can show user a new-version-available dialog describing features of the new version, and ask him whether to upgrade or not. When he agreed, use HCP to do the upgrade work or, download the necessary package by writing code if HCP not usable in this occasion.
By the way I have another question related: Why HCP only work on android phone, how to make it work on iOS phone.
Many thanks in advance for answering any one of the two questions, or both.
Thank you.
By the way I have another question related: Why HCP only work on android phone, how to make it work on iOS phone.
HCP should work on all platforms in the same way.
To show prompt dialog you have to intercept HCP in Reload._onMigrate hook:
import { Reload } from 'meteor/reload';
Reload._onMigrate(() => {
const decision = confirm("New version is available, would you like to upgrade now?")
return [decision]; // Return [false] to manually handle HCP
});
This is a very simple example, you can trigger nice UI/UX element to handle it.
For example we always return [false] in _onMigrate hook. Show to the user nice pop-up. And if user choose to update now, we trigger next function (pick options you need):
// Purge and reload cache for AppCache package
window.applicationCache.swapCache();
window.applicationCache.update();
// Drop ServiceWorker cache
window.caches.keys().then((keys) => {
keys.forEach((name) => {
window.caches.delete(name);
});
}).catch((err) => {
console.error('window.caches.delete', err);
});
// Unregister Service Worker
SWRegistration.unregister();
// Reload the page
if (window.location.hash || window.location.href.endsWith("#")) {
window.location.reload();
} else {
window.location.replace(window.location.href);
}
I am trying to understand what some of the uses cases are for dynamic permissions in Android. In other words, I am trying to understand why we have addPermission*() API methods and why just having static permissions is not sufficient. There doesn't seem to be much material out there explaining this, so I would appreciate some explanation.
Also, in order to understand what apps do with dynamic permissions, I downloaded some Android apps and started to reverse engineer them and look for the addPermission*() API methods in the source code. I've noticed that there are some apps that implement a wrapper class for PackageManager and I was wondering what the purpose is for doing this. Here is an example to the wrapper classes implemented by these apps, all they do is call the respective method of the PackageManager class:
public class PackageManagerWrapper
extends PackageManager
{
protected PackageManager mInner;
public PackageManagerWrapper()
{
this.mInner = null;
}
public PackageManagerWrapper(Context paramContext)
{
this.mInner = paramContext.getPackageManager();
}
#Inject
public PackageManagerWrapper(PackageManager paramPackageManager)
{
this.mInner = paramPackageManager;
}
public void addPackageToPreferred(String paramString)
{
this.mInner.addPackageToPreferred(paramString);
}
public boolean addPermission(PermissionInfo paramPermissionInfo)
{
return this.mInner.addPermission(paramPermissionInfo);
}
...
}
Thanks a lot!
Apps can define custom permissions in order to protect it's code / data but still let other apps (with the right permission) to use it. While it's easy to think of use cases - like a suite of apps need to share a data/functionality only between them, those can be achieved by using a <permission> tag in manifest. However, this API used only for creating permissions not yet used by any other app:
New permissions must be added before any .apks are installed that use those permissions. Permissions you add through this method are remembered across reboots of the device. If the given permission already exists, the info you supply here will be used to update it.
But still meant to be used by any app that had declared a permission-tree in it's manifest.
So, since it's creating permissions at runtime and therefore cannot be applied to own Activities/Services, we are left only with broadcasts. The only advantage of this API over declaring those permissions in Manifest I can think of is that the user don't need to update the application. So if you are having a suit of apps, with one 'main' app (similar to Google Play), and you want to be able to broadcast to new apps in this suit securely even if the user had not updated your app, you can still get updates over the net and add needed permissions to communicate with the new apps.
For your second question - it's cannot be deducted from you example. There might be several reasons, such as acting as Bridge, or in order to add custom functionality.
how can i make my application auto updatable ? pls help.
process that should not want user confirmation.it should be run after login automatically
`
new Thread()
{
#SuppressWarnings({ "null", "deprecation" })
#Override
public void run() {
Looper.prepare();
Handler refresh1 = new Handler(Looper.getMainLooper());
refresh1.post(new Runnable() {
public void run()
{
//i want do here background process that search applications new version and install it automatically.
}
}
}
}//ends thread
This is not possible, except perhaps on rooted devices. Apps cannot install other apps, including updates to their own app, without user involvement.
You can't do that... all you can do is use the Android Market API (not official) to alert the users with a new update: https://code.google.com/p/android-market-api/
Also, if you're using some webservice, you can make a validator with it... but not a single chance to auto update an app without user confirmation.
You could force users to upgrade by other means. Have your app check a URL on startup, perhaps an XML file on your website. The XML file contains the android:versionCode of the latest app release. The app then compares the retrieved version code value with its own version code, and if an upgrade is required, you can then have the app display a message "Upgrade required" or something similar, and you can either have it be a reminder message that pops up on startup (using a Toast, maybe) every time the app is run, or you can have the app refuse to function until it is upgraded.
Please note, implementing this type of behavior in your apps may violate app store policies, especially for paid apps.
How do i check if a in app purchase has been done before?
So that my user doesnt need to repurchase the in app purchase upon uninstalling and reinstalling the app?
I have set my in app item to managable in the android market publish page.
i have read about RESTORE_TRANSACTION but I do not know what i need to look for inside this response and also how to test this.
Any help would be greatly appreaciated.
You need to restore the transactions, using the RESTORE_TRANSACTION flag you specified above. You should only do this once, when the application starts for the first time or if the user clears the data.
I would advice to make this process simpler for yourself, you looking into the AndroidBillingLibrary, which allows you to interface with the Android In App Billing in a much simpler manner.
Here is a snippet of how the transactions are restored:
private void restoreTransactions() {
if (!mBillingObserver.isTransactionsRestored()) {
BillingController.restoreTransactions(this);
Toast.makeText(this, R.string.restoring_transactions, Toast.LENGTH_LONG).show();
}
}