小编Cyr*_*lin的帖子

在LockState中通过PhoneScreen显示Toast

我们的目标是在发生呼号时展示祝酒词.当设备被锁定并发生接收呼叫时,这将不起作用.然后在" 锁定的全屏幕进入呼叫视图" 后面可以看到吐司.

我们尝试了不同的approches,结果相同:

  • PhoneCallListener/BroadCastReciver
  • 而不是吐司,使用一些新的Intent与一些标志(ShowOnLockScreen等)

允许:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Run Code Online (Sandbox Code Playgroud)

PhoneCallListener的设置:

public class PhoneCallDetector : PhoneStateListener
{
    public override void OnCallStateChanged(CallState state, string incomingNumber)
    {
        ShowToast(incomingNumber);
        base.OnCallStateChanged(state, incomingNumber);
    }


    private void ShowToast(string phonenumber)
    {
        Toast toast = Toast.MakeText(Application.Context, phonenumber, ToastLength.Long);
        toast.SetGravity(GravityFlags.Center, 0, 0);
        toast.Show();
    }
}
Run Code Online (Sandbox Code Playgroud)

我们知道一些可以通过" 锁定的全屏嵌入调用视图"成功显示toast的应用程序,但是它们是用java编写的......它们也没有做任何特殊的事情,然后Toast.MakeText(....).

编辑: => PhoneStateListener在后台生命.从服务开始.

服务如何开始?

Intent serviceStart = new Intent(context, typeof(PhoneCallService));
context.StartService(serviceStart);
Run Code Online (Sandbox Code Playgroud)

如何调用PhoneCallDetector?

 var phoneCallDetector = m_scope.Resolve<PhoneCallDetector>();
 var tm = (TelephonyManager)GetSystemService(TelephonyService);
 tm.Listen(phoneCallDetector, PhoneStateListenerFlags.CallState);
Run Code Online (Sandbox Code Playgroud)

谢谢你帮助我:-)

c# xamarin.android android-toast xamarin.forms android-phone-call

13
推荐指数
1
解决办法
213
查看次数

Graph API calls to OnPremise Exchange only works in Playground

Our setup is an on-premise Exchange Server which is accessible over the graph api. https://docs.microsoft.com/en-us/graph/hybrid-rest-support

(https://www.msxfaq.de/cloud/graph/graph_und_exchange_onprem.htm)

We run in the issue, that our token is only "partial" working. And a token created by "Graph-Playground" is fully working. But we can't find any difference.

  • When I use Graph-Playground or use the token generated by Graph-Playground => all requests are working
  • When I create a token (over my app registration) => only some requests are working

The token seems to be valid some …

exchange-server hybrid on-premises-instances microsoft-graph-api

7
推荐指数
1
解决办法
670
查看次数