我无法弄清楚如何从Genymotion android模拟器访问localhost.顺便说一句,我使用MAMP.
我的 UITests 目标中有一个示例文本文件。我想将此文件复制到应用程序的文档目录中,以便当我在应用程序中执行文件上传测试时,我可以通过文件应用程序选择它并上传它。
我的互联网连接不稳定,需要恢复下载。我尝试使用wget:
我试过了,$ wget http://adcdownload.apple.com/Developer_Tools/Xcode_8/Xcode_8.xip但是我只能在终端上找到它:
--2016-09-21 15:13:17-- http://adcdownload.apple.com/Developer_Tools/Xcode_8/Xcode_8.xip 解析adcdownload.apple.com ... 203.177.38.83,203.177.38.120连接到adcdownload .apple.com | 203.177.38.83 |:80 ...已连接。HTTP请求已发送,正在等待响应... 302临时移动位置:http : //developer.apple.com/unauthorized/ [以下]由于HSTS策略,URL转换为HTTPS --2016-09-21 15:13:17 -https : //developer.apple.com/unauthorized/正在解析developer.apple.com ... 17.146.1.15已连接至developer.apple.com | 17.146.1.15 |:443...。HTTP请求已发送,正在等待响应... 200 OK长度:2070(2.0K)[text / html]保存到:'Xcode_8.xip'
Xcode_8.xip 100%[=================================>] 2.02K --.- KB / s in 0s
2016-09-21 15:13:18(85.8 MB / s)-已保存'Xcode_8.xip'[2070/2070]
我已经去了:
但是,我没有在我的 Android 手机(小米红米 5A、牛轧糖)的锁定屏幕中看到通知。顺便说一下,我正在本地通知。不涉及推送通知或 GCM。
我测试了 Gmail 应用程序,它运行良好。Gmail 通知显示在锁定屏幕中。
我是否错误地构建了通知?那我应该怎么建呢?
private fun showNotificationWith(message: String) {
val channelId = "com.example.notif.channelId"
val channelName = "App status"
val contentTitle = "Title"
val notificationManager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationBuilder = NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.drawable.ic_small_exclamation)
.setContentTitle(contentTitle)
.setContentText(message)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
val importance = NotificationManager.IMPORTANCE_HIGH
val notificationChannel = NotificationChannel(channelId, channelName, importance)
notificationBuilder.setChannelId(channelName)
notificationManager.createNotificationChannel(notificationChannel)
notificationManager.notify(message.hashCode(), notificationBuilder.build())
} else {
notificationManager.notify(message.hashCode(), notificationBuilder.build())
}
}
Run Code Online (Sandbox Code Playgroud)