android - Install application only on notification tab -


i show notification user once application has been downloaded.

i have installapk method installs downloaded application in code piece (completenotification) application gets automatically installed. need install once user tabs notification.

did overlooked something?

thank help.

the completenotification method:

public void completenotification() {         intent install = installapk(urlpath, context, mnotificationmanager,                 notifycationid);         pendingintent pending = pendingintent.getactivity(context, 0, install, 0);          mbuilder = new notificationcompat.builder(context)                 .setcontenttitle(appname)                 .setcontenttext("ready install.");         mbuilder.setcontentintent(pending);         mbuilder.setsmallicon(r.drawable.placeholder);         mbuilder.setdefaults(notification.default_sound);         mbuilder.setautocancel(true);         mnotificationmanager =                 (notificationmanager) context.getsystemservice(context.notification_service);         mnotificationmanager.notify(1, mbuilder.build());     } 

the installapk method:

public static intent installapk(string urlpath, context context,                                     notificationmanager mnotificationmanager, int notifycationid) {         intent apkintent = new intent();         apkintent.addflags(intent.flag_activity_new_task);         apkintent.setaction(android.content.intent.action_view);         file apkfile = new file(urlpath);         uri uri = uri.fromfile(apkfile);         apkintent                 .setdataandtype(uri, "application/vnd.android.package-archive");         context.startactivity(apkintent);         mnotificationmanager.cancel(notifycationid);         return apkintent;     }; 

remove line:

context.startactivity(apkintent); 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -