OTA updates for Device Owner Android Application(Kiosk mode)

前端 未结 4 1554
粉色の甜心
粉色の甜心 2021-02-07 04:03

I am able to make my app, the device owner app through NFC as mentioned here. Now I want to update my app over the air, but I couldn\'t find a method without rooting

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-07 04:53

    Create a service to background check for update. if update available download apk file and write it on some where like sdcard. wait some seconds to write completely flush. then call following code to install your new apk.

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
    startActivity(intent);
    

    fileName is path of your new apk file on sd card.

提交回复
热议问题