Android Question how to set automatic widget android in home screen

mehdibm69

New Member
hi my app is have a widget for make my app live for get and send gps location services i want after run my app if widget is no active in home screen is automaticly added this in there
 
This should let the user add widget:
Code: Copy
Private Sub Button1_Click
    Dim ComponentName As JavaObject
    ComponentName.InitializeNewInstance("android.content.ComponentName", Array(Application.PackageName, "widgetreceiver"))
    Log(ComponentName)
    Dim ctxt As JavaObject
    ctxt.InitializeContext
    Dim AppWidgetManager As JavaObject
    AppWidgetManager = AppWidgetManager.InitializeStatic("android.appwidget.AppWidgetManager").RunMethod("getInstance", Array(ctxt))
    Log(AppWidgetManager.RunMethod("isRequestPinAppWidgetSupported", Null))
    Log(AppWidgetManager.RunMethod("requestPinAppWidget", Array(ComponentName, Null, Null)))
End Sub

However it doesn't seem to work...
 
Upvote 0

Similar Threads

Back
Top