Sub GetNotifChannelMap(channelID As String) As String
Dim Channel As JavaObject
Dim channelObject As Object '
Dim m As Map
m.Initialize
Channel.InitializeContext
channelObject = Channel.RunMethod("mGetNotifChannel", Array(channelID))
' m = Channel.RunMethod("mGetNotifChannel", Array(channelID)) <<<< get the same error if trying like this
Log(channelObject)
m = channelObject <<< error here
Log(m)
End Sub
#if JAVA
import android.content.Context;
import android.app.NotificationManager;
import android.app.NotificationChannel;
import android.os.Build;
import java.util.List;
import android.net.Uri;
import anywheresoftware.b4a.objects.collections.Map;
public anywheresoftware.b4a.objects.collections.Map mGetNotifChannel(String channelId){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Context context = BA.applicationContext;
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel channel = notificationManager.getNotificationChannel(channelId);
String Id = channel.getId();
int importance = channel.getImportance();
int lightcolor = channel.getLightColor();
Boolean shVibrate = channel.shouldVibrate();
Boolean shShowLight = channel.shouldShowLights();
Uri sound = channel.getSound();
anywheresoftware.b4a.objects.collections.Map map = new anywheresoftware.b4a.objects.collections.Map();
map.Initialize();
map.Put("Id", Id);
map.Put("sound", sound);
map.Put("Importance", importance);
map.Put("lightcolor", lightcolor);
map.Put("shouldVibrate", shVibrate);
map.Put("shShowLight", shShowLight);
return map;
}
return null;
}
#End If